package network;

import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Li_DaChiZi
 * Date: 2025/7/11
 * Time: 16:26
 */
public class UdpDictServer extends UdpEchoServer{

    public Map<String,String> dict = new HashMap<>();

    public UdpDictServer (int port) throws SocketException {
        super(port);
        dict.put("小猪","pig");
        dict.put("小羊","sheep");
        dict.put("小马","horse");
        dict.put("小蛇","snake");
    }

    @Override
    public String process(String request) {
        return dict.getOrDefault(request,"未知汉字");
    }

    public static void main(String[] args) throws IOException {
        UdpDictServer server = new UdpDictServer(9090);
        server.start();
    }

}
